from typing import List


class Solution:
    def chalkReplacer(self, chalk: List[int], k: int) -> int:
        sum_ = sum(chalk)
        k %= sum_

        for i in range(len(chalk)):
            k -= chalk[i]
            if k < 0:
                return i

        return 0


if __name__ == "__main__":
    print(Solution().chalkReplacer(chalk=[5, 1, 5], k=22))  # 0
    print(Solution().chalkReplacer(chalk=[3, 4, 1, 2], k=25))  # 1
